import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { UserAdminService } from './user-admin.service';
import { CreateUserAdminDto } from './dto/create-user-admin.dto';
import { UpdateUserAdminDto } from './dto/update-user-admin.dto';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { Public } from '../auth/decorators/public.decorator';

@ApiBearerAuth()
@ApiTags('用户-后台')
@Controller('user-admin')
export class UserAdminController {
  constructor(private readonly userAdminService: UserAdminService) {}

  // 新增
  @Public()
  @Post('add')
  @ApiOperation({ summary: '新增', description: '新增' })
  create(@Body() dto: CreateUserAdminDto) {
    return this.userAdminService.create(dto);
  }

  @Get(':name')
  @ApiOperation({ summary: '详情', description: '详情' })
  findOne(@Param('name') name: string) {
    return this.userAdminService.findOne(name);
  }
}
